<template>
	<view class="v100" :style="{ backgroundImage: 'url(' + cosImageUrl('head_bg.png',true) + ')' }">
		<!-- 顶部导航 -->
		<u-sticky>
			<view class="zdex9" style="background-color: transparent;">
				<view class="">
					<view class="" :style="{'paddingTop':statusBarHeigh + 'px',}">
						<view class="flex alicen pl20" :style="{'height':menuButtonInfo.height + 'px',}">
							<view class="w40b">
								<u-icon name="arrow-left" color="#070707" size="18" @click="goback()"></u-icon>
							</view>
							<view class="fz30 bold">{{title}}</view>
						</view>
					</view>
				</view>
				<view class="pt20">
					<view class="flex  alicen evenly">
						<view class="mr10  flex alicen ius10">
							<view @click="selectProvince()"
								class="pt10 mr10 bgfff flex alicen mr10 pb10 pl20 pr20  nowrap col99 fz24 w100b txtcen ius10 border1 boreb">
								<view class="mr10 w100b text-word-break-1">{{provinceName||'院校省份'}}</view>
								<u-icon name="arrow-down" color="#070707" size="14"></u-icon>
							</view>
							<view
								class="pt10 ml20 bgfff mr10 flex alicen pr20 mr10 pb10 pl20  nowrap col99 fz24 w100b txtcen ius10 border1 boreb">
								<view class="mr10 w100b text-word-break-1">
									<input class="w100b txtleft" type="text" placeholder="请输入专业名称" v-model="name" />
								</view>
								<u-icon name="arrow-down" color="#070707" size="14"></u-icon>
							</view>

						</view>
						<view class="pt10 pb10 pl20 pr20 bgff000 colff fz24 ius10 flexCenter nowrap" @click="querySearool()">查询
						</view>
					</view>
				</view>
				<!-- 温馨提示 -->
				<view class="fz24 colb6 ml20 mr20 mt10"> <text
						class="col40 ml10">温馨提示:</text>院校或专业录取数据未满三年的,系统显示的概率会有偏差,请自行分析或咨询老师。
				</view>
			</view>
		</u-sticky>
		<!-- 卡片内容 -->
		<scroll-view v-if="suarr&&suarr.length > 0" scroll-y="true" class="hcalc" @scrolltolower="scrolltolower">
			<view class=" relative pt10 pb20 bgfff pl20 pr20 ius10 ml20 mt10 mr20" v-for="(item,i) in suarr" :key="i"
				@click="schoolDetail(item)">
				<view class="absolute  pr10 pl30 alicen flex  h60 bgsize100b no-repeat t0 r0"
					:style="{ backgroundImage: 'url(' + cosImageUrl('bage.png',true) + ')' }">
					<text class="fz24 bold colff">{{item.submitRate}}%</text>
				</view>
			
				<view class="flex between alicen w85b">
					<view class=""> <text class="fz30 bold mr20">{{item.sname}}</text> <text
							class="fz20">院校综合实力排行(供参考){{item.sranking}}</text> </view>
					<view class="bold fz24 bold nowrap">投档概率</view>
				</view>
				<view class="mb10 fz28 mt10 col33">院校代码: <text>{{item.scode}}</text> </view>
				<view class="mb10 fz28 col33">类型/性质: <text>{{item.stypes}}</text> </view>
				<view class="flex alicen">
					<view class="mb10 fz28 col33">院校专业组: <text>{{item.zyz}}</text> </view>
					<view class="mb10 fz28 col33 ml20">再选科目: <text>{{item.zxkm}}</text> </view>
				</view>
				<view class="pb20"></view>
				<com-table :hander_list="hander_list" :tableItem="item"></com-table>
			</view>
		</scroll-view>
		<view class="" v-else>
			<u-empty mode="list"></u-empty>
		</view>
		<com-popup :showPop="popObj.showRightPop" @popStatus="(i) => {popObj.showRightPop = i,popObj.isLoad = {}}">
			<com-selectList :flag="flag" :typesign="popObj.typesign" :popTypeName="popObj.popTypeName"
				:popTypeValue="popObj.popTypeValue" :list="popObj.popList" :title="popObj.popTitle" @submit="display"
				v-if="popObj.isLoad.selectList">
			</com-selectList>
		</com-popup>
	</view>
</template>

<script>
	import config from "@/config.js";
	import {
		province_list,
		school_level,
		school_types
	} from "@/utils/api/dict.js"
	import {
		zhfx_list_h5,
		zhfx_detail_h5
	} from "@/utils/api/generateWish.js"
	export default {
		data() {
			return {
				config: config,
				flag: false,
				name: '', //专业名称
				provinceName: '', //省份schoolTypes
				schoolTypesName: '', //性质特色
				schoolLevelName: '', //院校特色
				suarr: [], //查询到的数组
				title: '专业分析', //标题
				subsectionCurrent: 0,
				popObj: {
					popTypeName: "",
					popTypeValue: "",
					showRightPop: false,
					popTitle: "",
					typesign: '', //自定义标识
					popList: [],
					isLoad: {}
				},
				model1: {
					searchInfo: {
						province: "", //省份
						schoolTypes: "", //类型性质
						schoolCode2: "", //特点
						batch: "本科普通批",
						userId: this.$store.state.userId,
						pageNum: 1,
						schoolCodeInp: "",
						schoolNameInp: "",
						submitType: "L",
						provinceName: "全部"
					}
				},
				hander_list: [{
						id: 1,
						name: '省市'
					},
					{
						id: 2,
						name: '专业组招生人数'
					},
					{
						id: 3,
						name: '专业名称'
					},
					{
						id: 5,
						name: '专业招生人数'
					},
					{
						id: 5,
						name: '专业录取概率'
					},
					{
						id: 6,
						name: '专业排名(供参考)'
					},
					{
						id: 7,
						name: '收藏'
					}
				],
			}
		},
		onLoad(options) {
			if (options.name) {
				this.model1.searchInfo.pageNum = 1
				this.suarr = []
				this.name = options.name
				this.Searool();
			}
		},
		onUnload() {

		},
		computed: {
			//省份
			province() {
				return this.$store.state.province
			},
		},
		methods: {
			//大学详情
			schoolDetail(item) {
				console.log('itemitemitem',item)
				this.showloading();
				let params = {
					schoolCode: item.scode,
					zyz: item.zyz,
					userId: this.readData('useId'),
				}
				this.navgateTo('/pages/schoolDetail/schoolDetail', {
					params: JSON.stringify(params)
				})
			},
			selectProvince() {
				this.popObj.popTypeName = "省份"
				this.popObj.popTypeValue = "多选"
				this.popObj.typesign = "S" //自定义标识
				this.flag = false
				province_list({
					scrollstr: true
				}).then(res => {

					let temp = []
					res.map((item) => {
						let obj = {
							name: item.name,
							value: item.id
						}
						temp.push(obj)
					})
					console.log('temp', temp)
					this.popObj.popList = temp
					this.popObj.isLoad["selectList"] = true
					this.popObj.showRightPop = true
				})
			},
			searchool() {
				this.model1.searchInfo.pageNum = 1
				this.suarr = []
				this.Searool();
			},
			querySearool() {
				this.model1.searchInfo.pageNum = 1
				this.suarr = []
				this.Searool();
			},
			//查询
			async Searool() {
				let params = {
					pageNum:this.model1.searchInfo.pageNum,
					zyName: this.name,
					province: this.province,
					userId: this.readData('useId'),
					batch: '普通本科批'
				}
				let su = await this.request.get('/api/zyfx_list', {
					params
				});
				if (su.code == 200) {
					this.suarr  = this.suarr.concat(su.data)
				}
			},
			scrolltolower() {
				this.showloading();
				this.model1.searchInfo.pageNum++
				this.Searool();
			},
			//提交vuex
			display(item) {
				this.popObj.popTypeName = null
				this.popObj.popTypeValue = null
				this.popObj.popTitle = null
				this.popObj.popList = []
				this.popObj.isLoad = {}
				this.popObj.showRightPop = false
				if (item.potypesignValue == 'S') {
					this.provinceName = this.mitprovince(item.val, 'name')
					let province = this.mitprovince(item.val, 'value')
					this.$store.commit('probtn', province)
				}
			},
		},

	}
</script>

<style lang="less">
	.hcalc {
		height: calc(100vh - 280rpx);
		overflow: auto;
	}
</style>